package com.qf.service;

import com.alibaba.druid.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.mapper.DtsRegionMapper;
import com.qf.pojo.DtsRegion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author jiangjingbo
 * @version V1.0
 * @Project java2203
 * @Package com.qf.service
 * @Description:
 * @Date 2022/6/21 10:38
 */
@Service
public class ShoppingMallServiceimpl implements ShoppingMallService {
    @Autowired
    private DtsRegionMapper dtsRegionMapper;
    @Override
    public IPage<DtsRegion> findAll(Integer page, Integer limit ,String name, Integer code) {
        IPage<DtsRegion> IPage = new Page<>(page,limit);
        QueryWrapper<DtsRegion> queryWrapper =new QueryWrapper<>();
        if(!StringUtils.isEmpty(name)){
            queryWrapper.like("name",name);
        }
        if (!org.springframework.util.StringUtils.isEmpty(code)){
            queryWrapper.eq("code",code);
        }
        IPage<DtsRegion> regionIPage = dtsRegionMapper.selectPage(IPage,queryWrapper);
        return regionIPage;
    }

}
